package com.zhhtech.zhh.ui.base

import android.view.View
import androidx.viewbinding.ViewBinding
import com.zhhtech.zhh.ui.listener.OnCheckBean

abstract class BaseMultipleCheckAdapter<VB : ViewBinding, B : OnCheckBean> : BaseRecyclerAdapter<VB, B>() {
    fun getChecks(): MutableList<B> = mutableListOf<B>().apply {
        for (item in datas) {
            if (item.check) {
                add(item)
            }
        }
    }

    // 多选
    override fun subOnClickAdapter(v: View, position: Int) {
        val item = getItem(position)
        item.check = !item.check
        notifyItemChanged(position)
    }
}